<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>xxx</title>

</head>

<body>

    <script src="https://cdn.staticfile.org/jquery/2.2.4/jquery.min.js"></script>
    <script>
        let todolist = [{
            title: '我今天吃八个馒头',
            done: false,
        }, {
            title: '我今天学习jq',
            done: false
        }];
        // localStorage.setItem('todo', todolist);
        // 1. 本地存储里面只能存储字符串的数据格式，把我们的数组对象转换为字符串格式 JSON.stringify()
        localStorage.setItem('todo', JSON.stringify(todolist));
        let data = localStorage.getItem('todo');
        // console.log(data);

        // 2. 转换回对象格式
        let data2 = JSON.parse(data);
        console.log(data2);
    </script>
</body>

</html>